//
//  UserRoute.swift
//  LocaLink
//
//  Created by Icy on 2017/1/11.
//  Copyright © 2017年 Icy. All rights reserved.
//

import Foundation
import Alamofire
import NetWorkCore

/**
 快速补货路由
 */
public enum UserApi{
    /**
     登录
     */
    case login(username:String,password:String)
    ///注册
    case signup(param:[String: AnyObject])
    
}
extension UserApi: TargetType {
    
    //设置请求路径
    public var path: String {
        switch self {
        case .login:
            return "/api/v1/login"
        case .signup:
            return "/api/v1/signup"
        }
    }
    
    //设置请求方式 get post等
    public var method: HTTPMethod {
        switch self {
        default :
            return .post
            
        }
    }
    /// 设置请求参数
    public var parameters: Parameters? {
        switch self {
        case let .login(username,password):
            return ["username":username,"password":password]
        case let .signup(param):
            return param
        default :
            return nil
        }
    }
    
}
